package array

// 考虑顺序的情况下，先遍历背包
func combinationSum4(nums []int, target int) int {

	dp := make([]int, target+1)
	dp[0] = 1

	for i := range dp {
		for _, num := range nums {
			if i-num >= 0 {
				dp[i] += dp[i-num]
			}
		}
	}

	return dp[target]
}
